import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

import java.time.{LocalDate, LocalDateTime}
import java.time.format.DateTimeFormatter

object WordCount {
  def main(args: Array[String]): Unit = {
    /*val conf = new SparkConf().setMaster("local").setAppName("WordCount")
    val sc = new SparkContext(conf)
    //使用本地文本
    val lines:RDD[String] = sc.textFile("data/wc.txt")
    println("分区数量:"+lines.getNumPartitions)
    println("分区:"+lines.partitions)
    println("分区器:"+lines.partitioner)
    lines.flatMap(_.split("\\s+")).map((_,1)).reduceByKey(_+_).collect().foreach(println)
    Thread.sleep(1000000)
    sc.stop()*/




    //var dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss")
    //var localDateTime = LocalDateTime.parse("2021-10-11 11:11:11", dateTimeFormatter)

   //
   val date1 =  LocalDate.parse("2017-02-07")
    val date2 =  LocalDate.parse("2017-01-09")
    println(date1)
    println(date1.isAfter(date2))
  }
  def getHour(str: String): Int = {
    import org.joda.time.DateTime

    val dt = new DateTime(str.toLong)
    dt.getHourOfDay
  }
}
